package com.itheima.demo01;

import java.io.FileOutputStream;
import java.io.IOException;

public class IoOutputStream {

    public static void main(String[] args) throws IOException {
        //写入文件流

//        File file = new File("a.txt");
//      //创建文件
//        boolean newFile = file.createNewFile();


        //向文件中写入内容
        FileOutputStream fileOutputStream = new FileOutputStream("E:\\Java\\day16\\a.txt");


//        fileOutputStream.write(97);//写入单个字节
        byte[] bytes = {97, 98, 99, 100, 101}; //写入多个字节

//        fileOutputStream.write(bytes);
        fileOutputStream.write(bytes,1,3);

        //写入换行
        String wrap = "\r\n";
        byte[] bytes1 = wrap.getBytes();
        fileOutputStream.write(bytes1);

        //继续写入数据
        String str1 = "ewrererwqer";
        byte[] bytes2 = str1.getBytes();
        fileOutputStream.write(bytes2);


        fileOutputStream.close();


    }


}
